import myStorage from "../../utils/storage";
import { Button } from "antd";

export default function Welcome() {
  const handleClick = (type: number) => {
    switch (type) {
      case 1:
        myStorage.set("name", "张三");
        break;
      case 2:
        const name = myStorage.get("name");
        console.log(name);

        break;
      case 3:
        myStorage.set("name", "李四");
        break;
      case 4:
        myStorage.clear();
        break;
    }
  };

  return (
    <div>
      <Button onClick={() => handleClick(1)}>设置</Button>
      <Button onClick={() => handleClick(2)}>读取</Button>
      <Button onClick={() => handleClick(3)}>修改</Button>
      <Button onClick={() => handleClick(4)}>清空</Button>
    </div>
  );
}
